var obj1 = {id : 1};
var obj2 = JSON.parse(JSON.stringify(obj1));
// 深拷贝  JSON.parse(JSON.stringify(obj1));  递归
// 浅拷贝  Object.assign   [...] {...}
obj2.id = 2;
var num = 1;
var num2 = num;
num2 = 2;

console.log(obj1.id, 'id')
console.log(num, 'num')


// ES5 
var a = 1
// 3
function app () {
    // 2
    var b= 2
    console.log(a)
    function app2() {
        // 1
        console.log(a)
    }
}
console.log(b)


// es6

// {
    // let 
    // const
// }
for(var i = 0; i<10;i++){
    setTimeout(() => {
        console.log(i)
    }, 1000)
}

for(let i = 0; i<10;i++){
    setTimeout(() => {
        console.log(i)
    }, 1000)
}



// 原型链
// 对象  __proto__ 指向它构造函数的 prototype
// 函数  prototype
var obj  = {}; 
// obj.a => {} => obj.__proto__ => Object.prototype => null

function App() {

}
// App.prototype
var app = new App()
// app.a => app => app.__proto__ => App.prototype => obj.__proto__ => Object.prototype => null


function* app () {
    yield 1
    yield 2
    yield 3
    return 4
}
var app1 = app()
console.log(app1.next())
console.log(app1.next())
console.log(app1.next())
console.log(app1.next())

export 
export default {app}

import '../xxx'
import abbb from '.../xx'
import {app} from '.../xx'


